$OpenBSD: patch-data_Xsession_in,v 1.6 2014/03/27 19:19:17 ajacoutot Exp $

XXX push upstream

--- data/Xsession.in.orig	Tue Mar 18 05:23:44 2014
+++ data/Xsession.in	Thu Mar 27 18:24:20 2014
@@ -23,6 +23,8 @@
 # based on:
 # $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
 
+PATH="@X_PATH@:$PATH"
+
 command="$@"
 
 # this will go into the .xsession-errors along with all other echo's
@@ -173,6 +175,9 @@ if [ "x$command" = "xdefault" ] ; then
     command="/etc/X11/xinit/Xclients"
   elif [ -x /etc/X11/Xclients ]; then
     command="/etc/X11/Xclients"
+  elif [ -x "/etc/X11/xdm/Xsession" ]; then
+    # Load the default OpenBSD
+    command="/etc/X11/xdm/Xsession"
   else
     if [ -n "$zenity" ] ; then
 	disptext=`gettextfunc "System has no Xclients file, so starting a failsafe xterm session.  Windows will have focus only if the mouse pointer is above them.  To get out of this mode type 'exit' in the window."`
@@ -184,12 +189,17 @@ if [ "x$command" = "xdefault" ] ; then
   fi
 fi
 
+# Do not start ssh-agent(1) in case we run gnome-session (gnome-keyring
+# already provides the functionality of an SSH agent), see:
+# https://bugzilla.redhat.com/show_bug.cgi?id=441123
+if [ "x$command" != "xgnome-session" ]; then
 # add ssh-agent if found
 sshagent="`gdmwhich ssh-agent`"
 if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
     command="$sshagent -- $command"
 elif [ -z "$sshagent" ] ; then
     echo "$0: ssh-agent not found!"
+fi
 fi
 
 echo "$0: Setup done, will execute: $command"
